package com.hubt.controller;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fasterxml.jackson.databind.deser.std.StringArrayDeserializer;
import com.hubt.common.PageBean;
import com.hubt.service.PtRDutyService;
import com.hubt.vo.Dutyvo;

@Controller
@RequestMapping("/duty")
public class PtRUserDutyController {
	@Autowired PtRDutyService ptRDutyService;
	
	@RequestMapping(value = "/getDuties",method = RequestMethod.GET)
	@ResponseBody
	public PageBean<Dutyvo> pageBean(@Param("pageSize") Integer pageSize,@Param("pageNumber")Integer pageNumber){
		PageBean<Dutyvo> pageBean=new PageBean<Dutyvo>();
		pageBean=ptRDutyService.findBypage(pageNumber, pageSize);
		return pageBean;
	}

	@RequestMapping(value = "/remove",method = RequestMethod.GET)
	@ResponseBody
	public int delete(@Param("id")String id) {
		return ptRDutyService.delete(id);
	}
	
	@RequestMapping(value = "/update",method = RequestMethod.POST)
	@ResponseBody
	public int update(@Param("form")Dutyvo dutyvo) {
		return ptRDutyService.update(dutyvo);
	}
	
	@RequestMapping("/getDuty")
	@ResponseBody
	public Dutyvo getone(@Param("uuid")String uuid) {
		return ptRDutyService.getOne(uuid);
	}
	
	@RequestMapping(value = "/insert",method = RequestMethod.POST)
	@ResponseBody
	public int insert(@Param("form")Dutyvo dutyvo) {
		return ptRDutyService.insert(dutyvo);
	}
	
	
	@RequestMapping("/getDutyByOrganId")
	@ResponseBody
	public List<Dutyvo> getByorg(@Param("organId")String organId){
		return ptRDutyService.getbyOrg(organId);
	}
}
